<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>海狸视频配音{% if title %} | {{ title }}{% endif %}</title>
    <link rel="icon" href="{{ url_for('static', filename='image/logo.png') }}" type="image/png">
    <!-- Bootstrap 5.3.2 CSS -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap5.3.2.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}">
    <script src="{{ url_for('static', filename='js/bootstrap5.3.2.bundle.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/base.js') }}"></script>


    <!-- 以模块方式引入 index.js -->
    <script src="{{ url_for('static', filename='js/tools.js') }}"></script>

    <style>
        /* 自定义导航栏背景颜色，颜色可按需调整 */
        .custom-navbar-bg {
            background-color: #e9ecef;
        }

        /* 自定义字体大小，增大三分之一 */
        .custom-nav-font {
            font-size: 1.333em;
        }

        /* 定义激活状态的样式，点击时文字变为黑色并添加下划线 */
    .navbar-nav .nav-link.active {
        color: black; /* 设置激活状态文字颜色为黑色 */

        font-size: 1.5em; /* 增大字体大小，可按需调整 */
    }

        /* 统一导航栏链接字体样式 */
        .navbar-nav .nav-link {
            font-size: 1.333em; /* 与 custom-nav-font 保持一致 */
        }

        /* 隐藏整个页面的滚动条 */
        html::-webkit-scrollbar {
            display: none;
        }

        html {
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        /* 自定义导航栏样式 */
        .custom-navbar {
            font-weight: bold;
            width: 50%;
            margin: 0 auto;
        }

        /* ... 已有样式 ... */
        .custom-navbar-padding-x {
            padding-left: 10%;
            padding-right: 10%;
        }
    </style>
</head>

<body style="background-color: #fff; color: #000;">
<!-- 修改导航栏类，移除 bg-light 并添加自定义背景类 -->
<nav class="navbar navbar-expand-md custom-navbar-bg  custom-navbar-padding-x ">

    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
       <ul class="navbar-nav me-auto">
    <li class="nav-item {% if request.endpoint == 'index' %}active{% endif %}">
        <a class="nav-link" href="{{ url_for('index') }}">主页</a>
    </li>
    <li class="nav-item {% if request.endpoint == 'tts_index' %}active{% endif %}">
        <a class="nav-link" href="{{ url_for('tts_index') }}">生成语音</a>
    </li>
    <li class="nav-item {% if request.endpoint == 'setting' %}active{% endif %}">
        <a class="nav-link" href="{{ url_for('setting') }}">系统设置</a>
    </li>
</ul>
        {% if current_user.is_authenticated %}
            <ul class="navbar-nav ms-auto">
                <li class="nav-item">
                    {% if current_user.username != 'admin' %}
                        <a class="nav-link" style="color: lawngreen; font-weight: bold">
                            <i class="fas fa-coins"></i>
                            {{ current_user.prettier_budget }}
                        </a>
                    {% endif %}
                </li>
                <li class="nav-item">
                    <a class="nav-link"><b style="text-transform: capitalize;">{{ current_user.username }}</b></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('LogoutPage') }}" data-bs-toggle="tooltip"
                       data-bs-placement="bottom" title="点击退出登录">退出登录</a>
                </li>
            </ul>
        {% else %}
            <ul class="navbar-nav ms-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('LoginPage') }}" data-bs-toggle="tooltip"
                       data-bs-placement="bottom" title="点击进行登录">登录</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('RegisterPage') }}" data-bs-toggle="tooltip"
                       data-bs-placement="bottom" title="点击进行注册">注册</a>
                </li>
            </ul>
        {% endif %}
    </div>
</nav>
<br>
<!-- 显示消息 -->
{% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
        {% for category, message in messages %}
            <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
    {% endif %}
{% endwith %}

{% block body %}{% endblock %}

<!-- Bootstrap 5.3.0 JavaScript -->


<script>
    document.addEventListener('DOMContentLoaded', function () {
        var alertList = document.querySelectorAll('.alert');
        alertList.forEach(function (alert) {
            // 直接操作DOM元素添加关闭逻辑2秒后自动关闭
            setTimeout(() => {
                alert.remove(); // 直接移除元素
            }, 2000);

            // 保留Bootstrap的原生关闭功能
            alert.addEventListener('close.bs.alert', () => {
                alert.remove();
            });
        });
    });
</script>
</body>

</html>